home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9956 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  39 lines

  1. Path: news.cloud9.net!usenet
  2. From: jalvo@cloud9.net (John G. Alvord)
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.std.c,com[p.lang.std.c++
  4. Subject: preprocessing question
  5. Date: Tue, 05 Mar 1996 02:07:10 GMT
  6. Organization: Bet Your Business Technologies
  7. Message-ID: <313b9e9f.480978@NEWS.CLOUD9.NET>
  8. NNTP-Posting-Host: jalvo.dialup.cloud9.net
  9. X-Newsreader: Forte Agent .99d/16.182
  10.  
  11. I have a couple compilers argument about the following problem:
  12.  
  13.    #define XXX (1)
  14.    #include <stdio.h>
  15.    int main(void)
  16.    {
  17.        #if XXX
  18.            printf("Hello World!");
  19.        #endif
  20.        return 0;
  21.     }
  22.  
  23. most compilers I have tried preprocess the #if resulting in "#if (1)" and then
  24. follow that instruction to generate the printf() call.
  25.  
  26. One compiler (SAS/C 5.50 cross compiler on AIX for MVS) complains that the #if
  27. line is an illegal constant.  A close reading of the ANSI C standard document
  28. reveals a clause that seems to imply (my reading) that a pre-processed series
  29. of tokens that appear to be a preprocessing statement will be ignored. A
  30. coworker who is more experienced then me feels that the #if does not fall
  31. under that clause and the #if will be evaluated. His reasoning is that the
  32. preprocessed series of tokens is just a part of a preprocessing statement.
  33.  
  34. If someone can shed some light on this, he would make me very happy.
  35.  
  36. Thanks!
  37.  
  38. John Alvord
  39.